<div id="rankings">
	<script type="text/javascript">
		$(function(){
			$(".rk").click(function(){
				rankingBar = $(this).data('ranking');
				if (rankingBar){
					$.each($(".ranking"), function(index, element){
						if ($(element).attr("id") == rankingBar)
							$(element).removeClass("hidden");
						else
							$(element).addClass("hidden");
					});
				}
			});
		});
	</script>
	<div id="rankingHeader">
		<div class="option"><span class="rk" data-ranking="rankingATP">ATP</span></div>
		<div class="option"><span class="rk" data-ranking="rankingWTA">WTA</span></div>
		<div class="option"><span class="rk" data-ranking="rankingArgentine">Arg</span></div>
		<hr />
	</div>
	<div id="rankingContent">
		<?
		if (!empty($arrMalePlayers)){
		?>
		<div id="rankingATP" class="ranking">
			<div class="rankingTitle"><img src="<?=PUBLIC_IMAGES_PATH;?>atp_logo.png" class='miniFlag' />ATP Top Ten</div>
			<table id="rankingWorld">
				<thead>
					<tr>
						<th class='rankingFlag'></th><th>Pos.</th><th>Nombre</th><th>Pts.</th>
					</tr>
				</thead>
				<tbody>
					<?php
					$counter = 0;
					foreach($arrMalePlayers as $player){
						echo "<tr>";
						echo "<td class='rankingFlag " . ($counter % 2 == 0 ? "even" : "odd") . "'><img src='" . MAIN_IMAGES_FLAG_PATH . $player->getCountryId()->getFlag() . "' class='miniFlag' /></td><td class='rankingPosition'>" . $player->getRanking() . "</td><td class='rankingPlayerName'>" . $player->getName() . " " . $player->getSurname() . " </td><td> " . $player->getPoints() . "</td>";
						echo "</tr>";
						$counter++;
					}
					?>
				</tbody>
			</table>
		</div>
		<?
		}
		
		if (!empty($arrFemalePlayers)){
		?>
		<div id="rankingWTA" class="ranking hidden">
			<div class="rankingTitle"><img src="<?=PUBLIC_IMAGES_PATH;?>wta_logo.jpg" class='miniFlag' />WTA Top Ten</div>
			<table id="rankingWorld">
				<thead>
					<tr>
						<th class='rankingFlag'></th><th>Pos.</th><th>Nombre</th><th>Pts.</th>
					</tr>
				</thead>
				<tbody>
					<?php
					$counter = 0;
					foreach($arrFemalePlayers as $player){
						echo "<tr>";
						echo "<td class='rankingFlag " . ($counter % 2 == 0 ? "even" : "odd") . "'><img src='" . MAIN_IMAGES_FLAG_PATH . $player->getCountryId()->getFlag() . "' class='miniFlag' /></td><td class='rankingPosition'>" . $player->getRanking() . "</td><td class='rankingPlayerName'>" . $player->getName() . " " . $player->getSurname() . " </td><td> " . $player->getPoints() . "</td>";
						echo "</tr>";
						$counter++;
					}
					?>
				</tbody>
			</table>
		</div>
		<?
		}
		
		if (!empty($arrArgentinianPlayers)){
			$Image = MAIN_IMAGES_FLAG_PATH . $arrArgentinianPlayers[0]->getCountryId()->getFlag();
		?>
		<div id="rankingArgentine" class="ranking hidden">
			<div class="rankingTitle"><?="<img src='" . $Image . "' class='miniFlag' />"?><span>Los mejores</span></div>
			<table id="rankingArgentines">
				<thead>
					<tr>
						<th></th><th>Pos.</th><th>Nombre</th><th>Pts.</th>
					</tr>
				</thead>
				<tbody>
					<?php
					foreach($arrArgentinianPlayers as $player){
						echo "<tr>";
						echo "<td></td><td class='rankingPosition'>" . $player->getRanking() . "</td><td class='rankingPlayerName'>" . $player->getName() . " " . $player->getSurname() . " </td><td> " . $player->getPoints() . "</td>";
						echo "</tr>";	
					}
					?>
				</tbody>
			</table>
		</div>
		<?
		}
		?>
	</div>
</div>